package com.css.zfzx.sjcj.modules.hddcGeochemicalSvyPoint.repository;

import com.css.zfzx.sjcj.modules.hddcGeochemicalSvyLine.repository.entity.HddcGeochemicalsvylineEntity;
import com.css.zfzx.sjcj.modules.hddcGeochemicalSvyPoint.repository.entity.HddcGeochemicalsvypointEntity;
import com.css.zfzx.sjcj.modules.hddcGeochemicalSvyPoint.service.HddcGeochemicalsvypointService;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhangcong
 * @date 2020-11-28
 */
@Repository
public interface HddcGeochemicalsvypointRepository extends JpaRepository<HddcGeochemicalsvypointEntity, String> {
    @Modifying
    @Query(nativeQuery = true,value = "update hddc_geochemicalsvypoint set qualityinspection_status=:qualityinspection_status ,extends1=:extend1 where uuid=:uuid")
    void updateStatus(@Param("qualityinspection_status") String qualityinspection_status,@Param("extend1") String extend1,@Param("uuid") String uuid);

    @Query(nativeQuery = true,value = "select * from hddc_geochemicalsvypoint where is_valid=1 and (qualityinspection_status!=3 or qualityinspection_status is null) ")
    List<HddcGeochemicalsvypointEntity> findByAll();

    @Query(nativeQuery = true,value = "select * from hddc_geochemicalsvypoint where  id =?1 and is_valid=1")
    HddcGeochemicalsvypointEntity findbyId(String svypointid);

    HddcGeochemicalsvypointEntity findByUuidAndIsValid(String id, String isValid);
}
